
<!DOCTYPE HTML>
<html lang="" >
    <head>
        <meta charset="UTF-8">
        <meta content="text/html; charset=utf-8" http-equiv="Content-Type">
        <title>Eslint Vscode Format · GitBook</title>
        <meta http-equiv="X-UA-Compatible" content="IE=edge" />
        <meta name="description" content="">
        <meta name="generator" content="GitBook 3.2.3">
        
        
        
    
    <link rel="stylesheet" href="../gitbook/style.css">

    
            
                
                <link rel="stylesheet" href="../gitbook/gitbook-plugin-highlight/website.css">
                
            
                
                <link rel="stylesheet" href="../gitbook/gitbook-plugin-search/search.css">
                
            
                
                <link rel="stylesheet" href="../gitbook/gitbook-plugin-fontsettings/website.css">
                
            
        

    

    
        
    
        
    
        
    
        
    
        
    
        
    

        
    
    
    <meta name="HandheldFriendly" content="true"/>
    <meta name="viewport" content="width=device-width, initial-scale=1, user-scalable=no">
    <meta name="apple-mobile-web-app-capable" content="yes">
    <meta name="apple-mobile-web-app-status-bar-style" content="black">
    <link rel="apple-touch-icon-precomposed" sizes="152x152" href="../gitbook/images/apple-touch-icon-precomposed-152.png">
    <link rel="shortcut icon" href="../gitbook/images/favicon.ico" type="image/x-icon">

    
    <link rel="next" href="eventloop.html" />
    
    
    <link rel="prev" href="engineering.html" />
    

    </head>
    <body>
        
<div class="book">
    <div class="book-summary">
        
            
<div id="book-search-input" role="search">
    <input type="text" placeholder="Type to search" />
</div>

            
                <nav role="navigation">
                


<ul class="summary">
    
    

    

    
        
        
    
        <li class="chapter " data-level="1.1" data-path="../">
            
                <a href="../">
            
                    
                    Introduction
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.2" data-path="./">
            
                <a href="./">
            
                    
                    前端进阶
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.3" data-path="Grid System.html">
            
                <a href="Grid System.html">
            
                    
                    Grid System
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.4" data-path="Handwritten signature.html">
            
                <a href="Handwritten signature.html">
            
                    
                    Handwritten Signature
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.5" data-path="Mobile Soft Keyboard.html">
            
                <a href="Mobile Soft Keyboard.html">
            
                    
                    Mobile Soft Keyboard
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.6" data-path="authentication.html">
            
                <a href="authentication.html">
            
                    
                    Authentication
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.7" >
            
                <span>
            
                    
                    Code
            
                </span>
            

            
            <ul class="articles">
                
    
        <li class="chapter " data-level="1.7.1" >
            
                <span>
            
                    
                    Four Operations
            
                </span>
            

            
        </li>
    

            </ul>
            
        </li>
    
        <li class="chapter " data-level="1.8" data-path="control loading.html">
            
                <a href="control loading.html">
            
                    
                    Control Loading
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.9" data-path="downfile.html">
            
                <a href="downfile.html">
            
                    
                    Downfile
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.10" data-path="dynamic-routing.html">
            
                <a href="dynamic-routing.html">
            
                    
                    Dynamic Routing
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.11" data-path="ecs.html">
            
                <a href="ecs.html">
            
                    
                    Ecs
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.12" data-path="engineering.html">
            
                <a href="engineering.html">
            
                    
                    Engineering
            
                </a>
            

            
        </li>
    
        <li class="chapter active" data-level="1.13" data-path="eslint-vscode-format.html">
            
                <a href="eslint-vscode-format.html">
            
                    
                    Eslint Vscode Format
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.14" data-path="eventloop.html">
            
                <a href="eventloop.html">
            
                    
                    Eventloop
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.15" data-path="four-operations-1.html">
            
                <a href="four-operations-1.html">
            
                    
                    Four Operations 1
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.16" data-path="four-operations-2.html">
            
                <a href="four-operations-2.html">
            
                    
                    Four Operations 2
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.17" data-path="four-operations-3.html">
            
                <a href="four-operations-3.html">
            
                    
                    Four Operations 3
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.18" data-path="four-operations-4.html">
            
                <a href="four-operations-4.html">
            
                    
                    Four Operations 4
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.19" data-path="front end summary.html">
            
                <a href="front end summary.html">
            
                    
                    Front End Summary
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.20" data-path="git commit style.html">
            
                <a href="git commit style.html">
            
                    
                    Git Commit Style
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.21" data-path="git-commands.html">
            
                <a href="git-commands.html">
            
                    
                    Git Commands
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.22" data-path="high-quality-code.html">
            
                <a href="high-quality-code.html">
            
                    
                    High Quality Code
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.23" data-path="history.html">
            
                <a href="history.html">
            
                    
                    History
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.24" data-path="html-tag.html">
            
                <a href="html-tag.html">
            
                    
                    Html Tag
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.25" data-path="http-https-http2.html">
            
                <a href="http-https-http2.html">
            
                    
                    Http Https Http2
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.26" data-path="ignore log.html">
            
                <a href="ignore log.html">
            
                    
                    Ignore Log
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.27" >
            
                <span>
            
                    
                    Imgs
            
                </span>
            

            
        </li>
    
        <li class="chapter " data-level="1.28" data-path="javascript-optimization.html">
            
                <a href="javascript-optimization.html">
            
                    
                    Javascript Optimization
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.29" data-path="local application.html">
            
                <a href="local application.html">
            
                    
                    Local Application
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.30" data-path="locality.html">
            
                <a href="locality.html">
            
                    
                    Locality
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.31" data-path="loop-unrolling.html">
            
                <a href="loop-unrolling.html">
            
                    
                    Loop Unrolling
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.32" data-path="mobile recommendation.html">
            
                <a href="mobile recommendation.html">
            
                    
                    Mobile Recommendation
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.33" data-path="modal.html">
            
                <a href="modal.html">
            
                    
                    Modal
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.34" data-path="monitor.html">
            
                <a href="monitor.html">
            
                    
                    Monitor
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.35" data-path="performance.html">
            
                <a href="performance.html">
            
                    
                    Performance
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.36" data-path="print-talbe.html">
            
                <a href="print-talbe.html">
            
                    
                    Print Talbe
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.37" data-path="promise.html">
            
                <a href="promise.html">
            
                    
                    Promise
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.38" data-path="teaching.html">
            
                <a href="teaching.html">
            
                    
                    Teaching
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.39" data-path="vue refresh.html">
            
                <a href="vue refresh.html">
            
                    
                    Vue Refresh
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.40" data-path="vue-page-not-refresh.html">
            
                <a href="vue-page-not-refresh.html">
            
                    
                    Vue Page Not Refresh
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.41" data-path="why-learn-theory.html">
            
                <a href="why-learn-theory.html">
            
                    
                    Why Learn Theory
            
                </a>
            

            
        </li>
    

    

    <li class="divider"></li>

    <li>
        <a href="https://www.gitbook.com" target="blank" class="gitbook-link">
            Published with GitBook
        </a>
    </li>
</ul>


                </nav>
            
        
    </div>

    <div class="book-body">
        
            <div class="body-inner">
                
                    

<div class="book-header" role="navigation">
    

    <!-- Title -->
    <h1>
        <i class="fa fa-circle-o-notch fa-spin"></i>
        <a href=".." >Eslint Vscode Format</a>
    </h1>
</div>




                    <div class="page-wrapper" tabindex="-1" role="main">
                        <div class="page-inner">
                            
<div id="book-search-results">
    <div class="search-noresults">
    
                                <section class="normal markdown-section">
                                
                                <h1 id="eslint--stylelint--vscode&#x81EA;&#x52A8;&#x683C;&#x5F0F;&#x5316;&#x4EE3;&#x7801;2020">ESlint + stylelint + VSCode&#x81EA;&#x52A8;&#x683C;&#x5F0F;&#x5316;&#x4EE3;&#x7801;(2020)</h1>
<h2 id="eslint-&#x683C;&#x5F0F;&#x5316;-js-&#x4EE3;&#x7801;">eslint &#x683C;&#x5F0F;&#x5316; js &#x4EE3;&#x7801;</h2>
<p><img src="https://img-blog.csdnimg.cn/img_convert/2124694cc6805a78697657ba790f69a0.gif" alt=""></p>
<p>&#x672C;&#x6587;&#x7528; Vue &#x9879;&#x76EE;&#x505A;&#x793A;&#x8303;&#x3002;</p>
<p>&#x5229;&#x7528; Vue CLI &#x521B;&#x5EFA;&#x9879;&#x76EE;&#x65F6;&#x8981;&#x5C06; ESlint &#x9009;&#x4E0A;&#xFF0C;&#x4E0B;&#x8F7D;&#x5B8C;&#x4F9D;&#x8D56;&#x540E;&#xFF0C;&#x7528; VSCode &#x6253;&#x5F00;&#x9879;&#x76EE;&#x3002;</p>
<p>&#x5B89;&#x88C5;&#x63D2;&#x4EF6; ESLint&#xFF0C;&#x7136;&#x540E; <code>File</code> -&gt; <code>Preference</code>-&gt; <code>Settings</code>&#xFF08;&#x5982;&#x679C;&#x88C5;&#x4E86;&#x4E2D;&#x6587;&#x63D2;&#x4EF6;&#x5305;&#x5E94;&#x8BE5;&#x662F; &#x6587;&#x4EF6; -&gt; &#x9009;&#x9879; -&gt; &#x8BBE;&#x7F6E;&#xFF09;&#xFF0C;&#x641C;&#x7D22; eslint&#xFF0C;&#x70B9;&#x51FB; Edit in setting.json</p>
<p><img src="https://img-blog.csdnimg.cn/img_convert/9820d5a2ec912c0fa232908174911424.png" alt="&#x5728;&#x8FD9;&#x91CC;&#x63D2;&#x5165;&#x56FE;&#x7247;&#x63CF;&#x8FF0;"></p>
<p>&#x5C06;&#x4EE5;&#x4E0B;&#x9009;&#x9879;&#x6DFB;&#x52A0;&#x5230;&#x914D;&#x7F6E;&#x6587;&#x4EF6;</p>
<pre><code class="lang-js">    <span class="hljs-string">&quot;editor.codeActionsOnSave&quot;</span>: {
        <span class="hljs-string">&quot;source.fixAll&quot;</span>: <span class="hljs-literal">true</span>,
    },
</code></pre>
<p>&#x914D;&#x7F6E;&#x5B8C;&#x4E4B;&#x540E;&#xFF0C;VSCode &#x4F1A;&#x6839;&#x636E;&#x4F60;&#x5F53;&#x524D; Vue &#x9879;&#x76EE;&#x4E0B;&#x7684; <code>.eslintrc.js</code> &#x6587;&#x4EF6;&#x7684;&#x89C4;&#x5219;&#x6765;&#x9A8C;&#x8BC1;&#x548C;&#x683C;&#x5F0F;&#x5316;&#x4EE3;&#x7801;&#x3002;</p>
<p>PS&#xFF1A;&#x81EA;&#x52A8;&#x683C;&#x5F0F;&#x5316;&#x4EE3;&#x7801;&#x5728;&#x4FDD;&#x5B58;&#x65F6;&#x81EA;&#x52A8;&#x89E6;&#x53D1;&#xFF0C;&#x76EE;&#x524D;&#x8BD5;&#x4E86; JS &#x4EE5;&#x53CA; vue &#x6587;&#x4EF6;&#x4E2D;&#x7684; JS &#x4EE3;&#x7801;&#x90FD;&#x6CA1;&#x95EE;&#x9898;&#xFF0C;html &#x548C; vue &#x4E2D;&#x7684; html &#x548C; css &#x65E0;&#x6548;&#x3002;</p>
<h4 id="lint-staged">lint-staged</h4>
<p>&#x4F7F;&#x7528; <code>lint-staged</code> &#x53EF;&#x4EE5;&#x53EA;&#x5BF9; git &#x6682;&#x5B58;&#x533A;&#x4E0A;&#x7684;&#x6587;&#x4EF6;&#x8FDB;&#x884C;&#x6821;&#x9A8C;&#xFF0C;&#x4E0D;&#x9700;&#x8981;&#x5BF9;&#x6240;&#x6709;&#x7684;&#x6587;&#x4EF6;&#x8FDB;&#x884C; lint &#x68C0;&#x67E5;&#x3002;</p>
<p>&#x5B89;&#x88C5;</p>
<pre><code>npm i -D lint-staged
</code></pre><p>&#x5C06;&#x539F;&#x6765; <code>package.json</code> &#x6587;&#x4EF6;&#x4E2D;&#x7684;&#x4EE3;&#x7801;&#xFF1A;</p>
<pre><code class="lang-json"><span class="hljs-string">&quot;husky&quot;</span>: {
  <span class="hljs-string">&quot;hooks&quot;</span>: {
    <span class="hljs-string">&quot;pre-commit&quot;</span>: <span class="hljs-string">&quot;npm run lint&quot;</span>,
    <span class="hljs-string">&quot;commit-msg&quot;</span>: <span class="hljs-string">&quot;node script/verify-commit.js&quot;</span>,
    <span class="hljs-string">&quot;pre-push&quot;</span>: <span class="hljs-string">&quot;npm test&quot;</span>
  }
},
</code></pre>
<p>&#x6539;&#x4E3A;&#xFF1A;</p>
<pre><code class="lang-json"><span class="hljs-string">&quot;husky&quot;</span>: {
  <span class="hljs-string">&quot;hooks&quot;</span>: {
    <span class="hljs-string">&quot;pre-commit&quot;</span>: <span class="hljs-string">&quot;lint-staged&quot;</span>,
    <span class="hljs-string">&quot;commit-msg&quot;</span>: <span class="hljs-string">&quot;node script/verify-commit.js&quot;</span>,
    <span class="hljs-string">&quot;pre-push&quot;</span>: <span class="hljs-string">&quot;npm test&quot;</span>
  }
},
<span class="hljs-string">&quot;lint-staged&quot;</span>: {
  <span class="hljs-string">&quot;src/**/*.{js,jsx,ts,tsx}&quot;</span>: <span class="hljs-string">&quot;eslint&quot;</span>,
  <span class="hljs-string">&quot;test/**/*.{js,jsx,ts,tsx}&quot;</span>: <span class="hljs-string">&quot;eslint&quot;</span>
},
</code></pre>
<p>&#x6587;&#x4EF6;&#x8FC7;&#x6EE4;&#x8BF4;&#x660E;&#xFF1A;</p>
<pre><code class="lang-json">{
    <span class="hljs-string">&quot;*.js&quot;</span>: <span class="hljs-string">&quot;&#x9879;&#x76EE;&#x4E0B;&#x6240;&#x6709;&#x7684; js &#x6587;&#x4EF6;&#xFF08;&#x4E0D;&#x5305;&#x542B;&#x5B50;&#x6587;&#x4EF6;&#x5939;&#xFF09;&quot;</span>,
    <span class="hljs-string">&quot;**/*.js&quot;</span>: <span class="hljs-string">&quot;&#x9879;&#x76EE;&#x4E0B;&#x6240;&#x6709;&#x7684; js &#x6587;&#x4EF6;&quot;</span>,
    <span class="hljs-string">&quot;src/*.js&quot;</span>: <span class="hljs-string">&quot;src &#x76EE;&#x5F55;&#x6240;&#x6709;&#x7684; js &#x6587;&#x4EF6;&#xFF08;&#x4E0D;&#x5305;&#x542B;&#x5B50;&#x6587;&#x4EF6;&#x5939;&#xFF09;&quot;</span>,
    <span class="hljs-string">&quot;src/**/*.js&quot;</span>: <span class="hljs-string">&quot;src &#x76EE;&#x5F55;&#x6240;&#x6709;&#x7684; js &#x6587;&#x4EF6;&quot;</span>
}
</code></pre>
<p>&#x591A;&#x4E2A;&#x540E;&#x7F00;&#x5339;&#x914D;&#xFF1A;</p>
<pre><code class="lang-json"><span class="hljs-string">&quot;lint-staged&quot;</span>: {
    <span class="hljs-string">&quot;src/**/*.{js,jsx,ts,tsx}&quot;</span>: <span class="hljs-string">&quot;eslint&quot;</span>,
  },
</code></pre>
<h4 id="typescript">TypeScript</h4>
<p>&#x4E0B;&#x8F7D;&#x63D2;&#x4EF6;</p>
<pre><code>npm install --save-dev typescript @typescript-eslint/parser @typescript-eslint/eslint-plugin
</code></pre><p>&#x5728; <code>.eslintrc</code> &#x914D;&#x7F6E;&#x6587;&#x4EF6;&#xFF0C;&#x6DFB;&#x52A0;&#x4EE5;&#x4E0B;&#x4E24;&#x4E2A;&#x914D;&#x7F6E;&#x9879;&#xFF1A;</p>
<pre><code class="lang-json"><span class="hljs-string">&quot;parser&quot;</span>: <span class="hljs-string">&quot;@typescript-eslint/parser&quot;</span>,
<span class="hljs-string">&quot;plugins&quot;</span>: [
    <span class="hljs-string">&quot;@typescript-eslint&quot;</span>
],
</code></pre>
<p>&#x5C06;&#x6839;&#x76EE;&#x5F55;&#x4E0B;&#x7684; <code>package.json</code> &#x6587;&#x4EF6;&#x7684; <code>scripts</code> &#x9009;&#x9879;&#x6DFB;&#x52A0;&#x4EE5;&#x4E0B;&#x914D;&#x7F6E;&#x9879;&#xFF1A;</p>
<pre><code class="lang-json"><span class="hljs-string">&quot;scripts&quot;</span>: {
  <span class="hljs-string">&quot;lint&quot;</span>: <span class="hljs-string">&quot;eslint --ext .js,.ts,.tsx test/ src/&quot;</span>,
},
</code></pre>
<p><code>test/</code> <code>src/</code> &#x662F;&#x4F60;&#x8981;&#x6821;&#x9A8C;&#x7684;&#x76EE;&#x5F55;&#x3002;&#x4FEE;&#x6539;&#x5B8C;&#x540E;&#xFF0C;&#x73B0;&#x5728; ts &#x6587;&#x4EF6;&#x4E5F;&#x53EF;&#x4EE5;&#x81EA;&#x52A8;&#x683C;&#x5F0F;&#x5316;&#x4E86;&#x3002;</p>
<p><img src="https://img-blog.csdnimg.cn/img_convert/e990512dbf4bbf446017ec810b878ec1.gif" alt=""></p>
<h3 id="&#x6269;&#x5C55;">&#x6269;&#x5C55;</h3>
<p>&#x5176;&#x5B9E;&#x8FD8;&#x662F;&#x6709;&#x529E;&#x6CD5;&#x683C;&#x5F0F;&#x5316; vue &#x6587;&#x4EF6;&#x4E2D;&#x7684; html &#x548C; css &#x4EE3;&#x7801;&#x7684;&#xFF0C;&#x5229;&#x7528; vscode &#x81EA;&#x5E26;&#x7684;&#x683C;&#x5F0F;&#x5316;&#xFF0C;&#x5FEB;&#x6377;&#x952E;&#x662F; <code>shift + alt + f</code>&#xFF0C;&#x5047;&#x8BBE;&#x4F60;&#x5F53;&#x524D; vscode &#x6253;&#x5F00;&#x7684;&#x662F;&#x4E00;&#x4E2A; vue &#x6587;&#x4EF6;&#xFF0C;&#x6309;&#x4E0B; <code>shift + alt + f</code> &#x4F1A;&#x63D0;&#x793A;&#x4F60;&#x9009;&#x62E9;&#x4E00;&#x79CD;&#x683C;&#x5F0F;&#x5316;&#x89C4;&#x8303;&#xFF0C;&#x5982;&#x679C;&#x6CA1;&#x63D0;&#x793A;&#xFF0C;&#x90A3;&#x5C31;&#x662F;&#x5DF2;&#x7ECF;&#x6709;&#x9ED8;&#x8BA4;&#x7684;&#x683C;&#x5F0F;&#x5316;&#x89C4;&#x8303;&#x4E86;&#xFF08;&#x4E00;&#x822C;&#x662F; vetur &#x63D2;&#x4EF6;&#xFF09;&#xFF0C;&#x7136;&#x540E; vue &#x6587;&#x4EF6;&#x7684;&#x6240;&#x6709;&#x4EE3;&#x7801;&#x90FD;&#x4F1A;&#x683C;&#x5F0F;&#x5316;&#xFF0C;&#x5E76;&#x4E14;&#x683C;&#x5F0F;&#x5316;&#x89C4;&#x5219;&#x8FD8;&#x53EF;&#x4EE5;&#x81EA;&#x5DF1;&#x914D;&#x7F6E;&#xFF0C;&#x5982;&#x4E0B;&#x56FE;&#x6240;&#x793A;&#xFF0C;&#x53EF;&#x4EE5;&#x6839;&#x636E;&#x81EA;&#x5DF1;&#x7684;&#x559C;&#x597D;&#x6765;&#x9009;&#x62E9;&#x683C;&#x5F0F;&#x5316;&#x89C4;&#x5219;&#x3002;</p>
<p><img src="https://img-blog.csdnimg.cn/img_convert/f532633b2856c8e1cedaa6c38c176151.png" alt="&#x5728;&#x8FD9;&#x91CC;&#x63D2;&#x5165;&#x56FE;&#x7247;&#x63CF;&#x8FF0;"></p>
<p>&#x56E0;&#x4E3A;&#x4E4B;&#x524D;&#x5DF2;&#x7ECF;&#x8BBE;&#x7F6E;&#x8FC7; eslint &#x7684;&#x683C;&#x5F0F;&#x5316;&#x89C4;&#x5219;&#x4E86;&#xFF0C;&#x6240;&#x4EE5; vue &#x6587;&#x4EF6;&#x53EA;&#x9700;&#x8981;&#x683C;&#x5F0F;&#x5316; html &#x548C; css &#x4E2D;&#x7684;&#x4EE3;&#x7801;&#xFF0C;&#x4E0D;&#x9700;&#x8981;&#x683C;&#x5F0F;&#x5316; javascript &#x4EE3;&#x7801;&#xFF0C;&#x6211;&#x4EEC;&#x53EF;&#x4EE5;&#x8FD9;&#x6837;&#x914D;&#x7F6E;&#x6765;&#x7981;&#x6B62; vetur &#x683C;&#x5F0F;&#x5316; javascript &#x4EE3;&#x7801;&#xFF1A;</p>
<p><img src="https://img-blog.csdnimg.cn/img_convert/64fac739a981493721ae2fbdda495be0.png" alt="&#x5728;&#x8FD9;&#x91CC;&#x63D2;&#x5165;&#x56FE;&#x7247;&#x63CF;&#x8FF0;"></p>
<p>&#x7136;&#x540E;&#x56DE;&#x5230;&#x521A;&#x624D;&#x7684; vue &#x6587;&#x4EF6;&#xFF0C;&#x968F;&#x610F;&#x6253;&#x4E71;&#x4EE3;&#x7801;&#x7684;&#x683C;&#x5F0F;&#xFF0C;&#x518D;&#x6309;&#x4E0B; <code>shift + alt + f</code> &#xFF0C;&#x4F1A;&#x53D1;&#x73B0; html &#x548C; css &#x4E2D;&#x7684;&#x4EE3;&#x7801;&#x5DF2;&#x7ECF;&#x683C;&#x5F0F;&#x5316;&#x4E86;&#xFF0C;&#x4F46;&#x662F; javascript &#x7684;&#x4EE3;&#x7801;&#x5E76;&#x6CA1;&#x683C;&#x5F0F;&#x5316;&#x3002;&#x6CA1;&#x5173;&#x7CFB;&#xFF0C;&#x56E0;&#x4E3A;&#x5DF2;&#x7ECF;&#x8BBE;&#x7F6E;&#x4E86; eslint &#x683C;&#x5F0F;&#x5316;&#xFF0C;&#x6240;&#x4EE5;&#x53EA;&#x8981;&#x4FDD;&#x5B58;&#xFF0C;javascript &#x7684;&#x4EE3;&#x7801;&#x4E5F;&#x4F1A;&#x81EA;&#x52A8;&#x683C;&#x5F0F;&#x5316;&#x3002;</p>
<p>&#x540C;&#x7406;&#xFF0C;&#x5176;&#x4ED6;&#x7C7B;&#x578B;&#x7684;&#x6587;&#x4EF6;&#x4E5F;&#x53EF;&#x4EE5;&#x8FD9;&#x6837;&#x6765;&#x8BBE;&#x7F6E;&#x683C;&#x5F0F;&#x5316;&#x89C4;&#x8303;&#x3002;</p>
<h2 id="stylelint-&#x683C;&#x5F0F;&#x5316;-css-&#x4EE3;&#x7801;">stylelint &#x683C;&#x5F0F;&#x5316; css &#x4EE3;&#x7801;</h2>
<p>&#x4E0B;&#x8F7D;&#x4F9D;&#x8D56;</p>
<pre><code>npm install --save-dev stylelint stylelint-config-standard
</code></pre><p>&#x5728;&#x9879;&#x76EE;&#x6839;&#x76EE;&#x5F55;&#x4E0B;&#x65B0;&#x5EFA;&#x4E00;&#x4E2A; <code>.stylelintrc.json</code> &#x6587;&#x4EF6;&#x5E76;&#x8F93;&#x5165;&#x4EE5;&#x4E0B;&#x5185;&#x5BB9;&#xFF1A;</p>
<pre><code class="lang-json">{
    <span class="hljs-string">&quot;extends&quot;</span>: <span class="hljs-string">&quot;stylelint-config-standard&quot;</span>
}
</code></pre>
<p>VSCode &#x6DFB;&#x52A0; <code>stylelint</code> &#x63D2;&#x4EF6;</p>
<p><img src="https://img-blog.csdnimg.cn/img_convert/afa020a625f5c5aee5fa304d35eb6682.png" alt="&#x5728;&#x8FD9;&#x91CC;&#x63D2;&#x5165;&#x56FE;&#x7247;&#x63CF;&#x8FF0;"></p>
<p>&#x7136;&#x540E;&#x5C31;&#x53EF;&#x4EE5;&#x770B;&#x5230;&#x6548;&#x679C;&#x4E86;&#x3002;</p>
<p><img src="https://img-blog.csdnimg.cn/img_convert/6156343f2a04454fa1d843f8bdecd07e.gif" alt="&#x5728;&#x8FD9;&#x91CC;&#x63D2;&#x5165;&#x56FE;&#x7247;&#x63CF;&#x8FF0;"></p>
<p>&#x5982;&#x679C;&#x4F60;&#x60F3;&#x4FEE;&#x6539;&#x63D2;&#x4EF6;&#x7684;&#x9ED8;&#x8BA4;&#x89C4;&#x5219;&#xFF0C;&#x53EF;&#x4EE5;&#x770B;<a href="https://github.com/stylelint/stylelint/blob/5a8465770b4ec17bb1b47f359d1a17132a204a71/docs/user-guide/rules/list.md" target="_blank">&#x5B98;&#x65B9;&#x6587;&#x6863;</a>&#xFF0C;&#x5B83;&#x63D0;&#x4F9B;&#x4E86; 170 &#x9879;&#x89C4;&#x5219;&#x4FEE;&#x6539;&#x3002;&#x4F8B;&#x5982;&#x6211;&#x60F3;&#x8981;&#x7528; 4 &#x4E2A;&#x7A7A;&#x683C;&#x4F5C;&#x4E3A;&#x7F29;&#x8FDB;&#xFF0C;&#x53EF;&#x4EE5;&#x8FD9;&#x6837;&#x914D;&#x7F6E;&#xFF1A;</p>
<pre><code class="lang-json">{
    <span class="hljs-string">&quot;extends&quot;</span>: <span class="hljs-string">&quot;stylelint-config-standard&quot;</span>,
    <span class="hljs-string">&quot;rules&quot;</span>: {
        <span class="hljs-string">&quot;indentation&quot;</span>: <span class="hljs-number">4</span>
    }
}
</code></pre>

                                
                                </section>
                            
    </div>
    <div class="search-results">
        <div class="has-results">
            
            <h1 class="search-results-title"><span class='search-results-count'></span> results matching "<span class='search-query'></span>"</h1>
            <ul class="search-results-list"></ul>
            
        </div>
        <div class="no-results">
            
            <h1 class="search-results-title">No results matching "<span class='search-query'></span>"</h1>
            
        </div>
    </div>
</div>

                        </div>
                    </div>
                
            </div>

            
                
                <a href="engineering.html" class="navigation navigation-prev " aria-label="Previous page: Engineering">
                    <i class="fa fa-angle-left"></i>
                </a>
                
                
                <a href="eventloop.html" class="navigation navigation-next " aria-label="Next page: Eventloop">
                    <i class="fa fa-angle-right"></i>
                </a>
                
            
        
    </div>

    <script>
        var gitbook = gitbook || [];
        gitbook.push(function() {
            gitbook.page.hasChanged({"page":{"title":"Eslint Vscode Format","level":"1.13","depth":1,"next":{"title":"Eventloop","level":"1.14","depth":1,"path":"前端进阶/eventloop.md","ref":"前端进阶/eventloop.md","articles":[]},"previous":{"title":"Engineering","level":"1.12","depth":1,"path":"前端进阶/engineering.md","ref":"前端进阶/engineering.md","articles":[]},"dir":"ltr"},"config":{"gitbook":"*","theme":"default","variables":{},"plugins":["summary","livereload"],"pluginsConfig":{"summary":{},"livereload":{},"highlight":{},"search":{},"lunr":{"maxIndexSize":1000000,"ignoreSpecialCharacters":false},"sharing":{"facebook":true,"twitter":true,"google":false,"weibo":false,"instapaper":false,"vk":false,"all":["facebook","google","twitter","weibo","instapaper"]},"fontsettings":{"theme":"white","family":"sans","size":2},"theme-default":{"styles":{"website":"styles/website.css","pdf":"styles/pdf.css","epub":"styles/epub.css","mobi":"styles/mobi.css","ebook":"styles/ebook.css","print":"styles/print.css"},"showLevel":false}},"structure":{"langs":"LANGS.md","readme":"README.md","glossary":"GLOSSARY.md","summary":"SUMMARY.md"},"pdf":{"pageNumbers":true,"fontSize":12,"fontFamily":"Arial","paperSize":"a4","chapterMark":"pagebreak","pageBreaksBefore":"/","margin":{"right":62,"left":62,"top":56,"bottom":56}},"styles":{"website":"styles/website.css","pdf":"styles/pdf.css","epub":"styles/epub.css","mobi":"styles/mobi.css","ebook":"styles/ebook.css","print":"styles/print.css"}},"file":{"path":"前端进阶/eslint-vscode-format.md","mtime":"2021-02-15T12:04:36.000Z","type":"markdown"},"gitbook":{"version":"3.2.3","time":"2021-03-24T08:50:55.666Z"},"basePath":"..","book":{"language":""}});
        });
    </script>
</div>

        
    <script src="../gitbook/gitbook.js"></script>
    <script src="../gitbook/theme.js"></script>
    
        
        <script src="../gitbook/gitbook-plugin-livereload/plugin.js"></script>
        
    
        
        <script src="../gitbook/gitbook-plugin-search/search-engine.js"></script>
        
    
        
        <script src="../gitbook/gitbook-plugin-search/search.js"></script>
        
    
        
        <script src="../gitbook/gitbook-plugin-lunr/lunr.min.js"></script>
        
    
        
        <script src="../gitbook/gitbook-plugin-lunr/search-lunr.js"></script>
        
    
        
        <script src="../gitbook/gitbook-plugin-sharing/buttons.js"></script>
        
    
        
        <script src="../gitbook/gitbook-plugin-fontsettings/fontsettings.js"></script>
        
    

    </body>
</html>

